home *** CD-ROM | disk | FTP | other *** search
- /* πCALC 1.0b
- * -Bloom!- Software Group
- *
- * πCALC was written Robert Rose
- *
- * Requires ANSI and THINK C 4.x or higher
- */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <console.h>
-
- main()
- {
- long double pi, x, pi2, x2, i;
-
- console_options.title = "\pπCALC 1.0";
- cshow(stdout);
- printf("πCALC by Robert Rose\n");
- printf("-Bloom!- Software Group\n");
- printf("\n");
- printf("Special thanks to Wayne Jackson for the π equation!\n");
- printf("***PRESS COMMAND-PERIOD OR ESCAPE TO QUIT***\n");
- printf("\n");
-
- x = 3;
- pi2 = 4;
- i = 0;
- while ( ++i > (-1)) { /* All this does is make it loop */
- pi = pi2 - (4 / x);
- printf("%Lg: π = %Lg\n", i, pi); /* Use %Lg for C to decide */
- pi2 = pi;
- x2 = x;
- x = x2 + 2;
- i++;
- pi = pi2 + (4 / x);
- printf("%Lg: π = %Lg\n", i, pi);
- pi2 = pi;
- x2 = x;
- x = x2 + 2;
- }
- }